<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            border: 0;
            box-sizing: border-box;
        }

        .border {
            margin: 50px auto;
            width: 1200px;
            height: 460px;
            outline: 1px solid red;
            overflow: hidden;
        }
        ul {
            list-style: none;
        }
        li {
            float: left;
            width: 240px;
            height: 460px;
            transition: all 0.5s;
        }
    </style>
</head>

<body>

    <div class="border">
        <ul>
            <li><a href="#"><img src="./imgs/1.jpg" alt=""></a></li>
            <li><a href="#"><img src="./imgs/2.jpg" alt=""></a></li>
            <li><a href="#"><img src="./imgs/3.jpg" alt=""></a></li>
            <li><a href="#"><img src="./imgs/4.jpg" alt=""></a></li>
            <li><a href="#"><img src="./imgs/5.jpg" alt=""></a></li>
        </ul>
    </div>
    <script>
        const allLi = document.querySelectorAll('li')
        for (let index = 0; index < allLi.length; index++) {
            allLi[index].addEventListener('mouseenter', function(e){
                for (let j = 0; j < allLi.length; j++) {
                    const element = allLi[j]
                    element.style.width = "100px"    
                }
                allLi[index].style.width = "800px"    
            })
            allLi[index].addEventListener('mouseleave', function(e){
                for (let j = 0; j < allLi.length; j++) {
                    const element = allLi[j]
                    element.style.width = "240px"    
                }
            })
            
        }
    </script>

</body>

</html>